<template>
  <!--下方左右布局-->
  <a-row :gutter="[10, 10]">
    <!--左侧-->
    <a-col :span="24">
      <a-row :gutter="[10, 10]">
        <!--   企业动态各类报表 -->
        <a-col :span="12">
          <Category />
        </a-col>
        <a-col :span="12">
          <Gradient />
        </a-col>
        <a-col :span="12">
          <Gauge />
        </a-col>
        <a-col :span="12">
          <Pie />
        </a-col>
      </a-row>
    </a-col>
  </a-row>
  <!-- 通知公告 -->
  <a-modal v-model:open="modal1Visible" style="top: 300px" :footer="null" :forceRender="true" title="公告">
    <div v-if="NameList">
      <h3 style="text-align: center">{{ NameList.bltitle }}</h3>
      <div>
        {{ NameList.blcontent }}
      </div>
    </div>
  </a-modal>
</template>
<script setup>
  import { computed, onMounted, reactive, ref } from 'vue';
  import HomeHeader from './home-header.vue';
  import HomeNotice from './home-notice.vue';
  import HomeQuickEntry from './components/quick-entry/home-quick-entry.vue';
  import OfficialAccountCard from './components/official-account-card.vue';
  import ToBeDoneCard from './components/to-be-done-card.vue';
  import ChangelogCard from './components/changelog-card.vue';
  import Gauge from './components/echarts/gauge.vue';
  import Category from './components/echarts/category.vue';
  import Pie from './components/echarts/pie.vue';
  import Gradient from './components/echarts/gradient.vue';
  import { Modal } from 'ant-design-vue';
  import { homeApi } from '../../../api/system/home-api';
  import { smartSentry } from '/@/lib/smart-sentry';
  import { useUserStore } from '../../../store/modules/system/user';
  import { storeToRefs } from 'pinia';
  const mainStore = useUserStore();
  // 业绩完成百分比
  const saleTargetPercent = computed(() => {
    return 75;
  });
  const modal1Visible = ref(false);
  const isFlage = ref(true);
  let NameList = reactive();
  const getInitDate = async () => {
    const { blsysuserid } = storeToRefs(mainStore);
    try {
      let obj = {
        userId: blsysuserid.value,
      };

      let res = await homeApi.BlannoundMent(obj);
      console.log(res, '12');
      if (res.data) {
        NameList = res.data;
        modal1Visible.value = true;
        isFlage.value = false;
        localStorage.setItem('flage', isFlage.value);
      } else {
        modal1Visible.value = false;
      }
    } catch (error) {
      smartSentry.captureError(error);
      modal1Visible.value = false;
    }
  };
  onMounted(() => {
    //通知公告
    let ishow = localStorage.getItem('flage');
    if (!ishow) {
      getInitDate();
    }
  });
</script>
<style lang="less" scoped>
  @import './index.less';
</style>
